﻿namespace SugarTank.Mobile.Helpers
{
    using System.Windows;
    using System.Windows.Media;
    using CommonTypes.Enums;

    public static class ApplicationExtensions
    {
        /// <summary>
        /// The specified phone theme.
        /// </summary>
        public static Theme Theme(this Application application)
        {
            var backgroundBrush = Application.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush;

            if (backgroundBrush != null)
            {
                if (backgroundBrush.Color == Color.FromArgb(255, 255, 255, 255))
                {
                    return CommonTypes.Enums.Theme.Light;
                }
            }

            return CommonTypes.Enums.Theme.Dark;
        }
    }
}